
<!--
top.header.szHelp="h_Fire_Rules_Edit.html";

    function doLoad() {
        top.buttom.location="buttom.html";
    }

    function doSubmit() {
        top.buttom.location="ack.html";
    }

ns = (document.layers) ? true : false;
ie = (document.all) ? true : false;
function SourceIPTypeChange(form)
{
var Sourcetype = form.FWRCfg_SrcAddrType.selectedIndex;
form.FWRCfg_SrcList.selectedIndex = -1;
form.FWRCfg_SrcAdd.disabled = false;
form.FWRCfg_SrcEdit.disabled = true;
form.FWRCfg_SrcDelete.disabled = true;
switch(Sourcetype)
{
case 0:
form.FWRCfg_SrcStartIP.value = "0.0.0.0";
form.FWRCfg_SrcEndIP.value = "0.0.0.0";
form.FWRCfg_SrcSubnetMask.value = "0.0.0.0";
form.FWRCfg_SrcStartIP.disabled = true;
form.FWRCfg_SrcEndIP.disabled = true;
form.FWRCfg_SrcSubnetMask.disabled = true;
break;
case 1:
form.FWRCfg_SrcEndIP.value = "0.0.0.0";
form.FWRCfg_SrcSubnetMask.value = "0.0.0.0";
form.FWRCfg_SrcStartIP.disabled = false;
form.FWRCfg_SrcEndIP.disabled = true;
form.FWRCfg_SrcSubnetMask.disabled = true;
break;
case 2:
form.FWRCfg_SrcSubnetMask.value = "0.0.0.0";
form.FWRCfg_SrcStartIP.disabled = false;
form.FWRCfg_SrcEndIP.disabled = false;
form.FWRCfg_SrcSubnetMask.disabled = true;
break;
case 3:
form.FWRCfg_SrcEndIP.value = "0.0.0.0";
form.FWRCfg_SrcStartIP.disabled = false;
form.FWRCfg_SrcEndIP.disabled = true;
form.FWRCfg_SrcSubnetMask.disabled = false;
break;
default:
break;
}
}
function DestIPTypeChange(form)
{
var Desttype = form.FWRCfg_DestAddrType.selectedIndex;
form.FWRCfg_DestList.selectedIndex = -1;
form.FWRCfg_DestAdd.disabled = false;
form.FWRCfg_DestEdit.disabled = true;
form.FWRCfg_DestDelete.disabled = true;
switch(Desttype)
{
case 0:
form.FWRCfg_DestStartIP.value = "0.0.0.0";
form.FWRCfg_DestEndIP.value = "0.0.0.0";
form.FWRCfg_DestSubnetMask.value = "0.0.0.0";
form.FWRCfg_DestStartIP.disabled = true;
form.FWRCfg_DestEndIP.disabled = true;
form.FWRCfg_DestSubnetMask.disabled = true;
break;
case 1:
form.FWRCfg_DestEndIP.value = "0.0.0.0";
form.FWRCfg_DestSubnetMask.value = "0.0.0.0";
form.FWRCfg_DestStartIP.disabled = false;
form.FWRCfg_DestEndIP.disabled = true;
form.FWRCfg_DestSubnetMask.disabled = true;
break;
case 2:
form.FWRCfg_DestSubnetMask.value = "0.0.0.0";
form.FWRCfg_DestStartIP.disabled = false;
form.FWRCfg_DestEndIP.disabled = false;
form.FWRCfg_DestSubnetMask.disabled = true;
break;
case 3:
form.FWRCfg_DestEndIP.value = "0.0.0.0";
form.FWRCfg_DestStartIP.disabled = false;
form.FWRCfg_DestEndIP.disabled = true;
form.FWRCfg_DestSubnetMask.disabled = false;
break;
default:
break;
}
}
function srcListFocus(form)
{
form.FWRCfg_SrcAdd.disabled = true;
form.FWRCfg_SrcEdit.disabled = false;
form.FWRCfg_SrcDelete.disabled = false;
}
function destListFocus(form)
{
form.FWRCfg_DestAdd.disabled = true;
form.FWRCfg_DestEdit.disabled = false;
form.FWRCfg_DestDelete.disabled = false;
}
function StartSrcBlur(form)
{
if(form.FWRCfg_SrcAddrType.selectedIndex != 3)
return;
IP =form.FWRCfg_SrcStartIP.value;
IP = IP.replace(/ /g, "");
IPsplit = IP.split(".");
if(IPsplit.length != 4 )
return;
for(i = 0; i < 4; i++)
if((isNaN(IPsplit[i])) || (IPsplit[i] == 'undefined') || (IPsplit[i] == ""))
return;
else
if((parseInt(IPsplit[i], 10) > 255) || (parseInt(IPsplit[i], 10) < 0))
return;
if(parseInt(IPsplit[0], 10) >= 192){
form.FWRCfg_SrcSubnetMask.value = "255.255.255.0";
}
else if(parseInt(IPsplit[0], 10) >= 128){
form.FWRCfg_SrcSubnetMask.value = "255.255.0.0";
}
else if(parseInt(IPsplit[0], 10) >= 0){
form.FWRCfg_SrcSubnetMask.value = "255.0.0.0";
}
}
function StartDestBlur(form)
{
if(form.FWRCfg_DestAddrType.selectedIndex != 3)
return;
IP =form.FWRCfg_DestStartIP.value;
IP = IP.replace(/ /g, "");
IPsplit = IP.split(".");
if(IPsplit.length != 4 )
return;
for(i = 0; i < 4; i++)
if((isNaN(IPsplit[i])) || (IPsplit[i] == 'undefined') || (IPsplit[i] == ""))
return;
else
if((parseInt(IPsplit[i], 10) > 255) || (parseInt(IPsplit[i], 10) < 0))
return;
if(parseInt(IPsplit[0], 10) >= 192){
form.FWRCfg_DestSubnetMask.value = "255.255.255.0";
}
else if(parseInt(IPsplit[0], 10) >= 128){
form.FWRCfg_DestSubnetMask.value = "255.255.0.0";
}
else if(parseInt(IPsplit[0], 10) >= 0){
form.FWRCfg_DestSubnetMask.value = "255.0.0.0";
}
}
function BlockAllClick(form)
{
if(form.FWRCfg_Everyday){
if(form.FWRCfg_Everyday.checked) {
form.RCfg_Sun.checked = true;
form.RCfg_Mon.checked = true;
form.RCfg_Tue.checked = true;
form.RCfg_Wed.checked = true;
form.RCfg_Thu.checked = true;
form.RCfg_Fri.checked = true;
form.RCfg_Sat.checked = true;
form.RCfg_Sun.disabled = true;
form.RCfg_Mon.disabled = true;
form.RCfg_Tue.disabled = true;
form.RCfg_Wed.disabled = true;
form.RCfg_Thu.disabled = true;
form.RCfg_Fri.disabled = true;
form.RCfg_Sat.disabled = true;
} else {
form.RCfg_Sun.disabled = false;
form.RCfg_Mon.disabled = false;
form.RCfg_Tue.disabled = false;
form.RCfg_Wed.disabled = false;
form.RCfg_Thu.disabled = false;
form.RCfg_Fri.disabled = false;
form.RCfg_Sat.disabled = false;
}
}
return;
}
function BlockPeriodClick(form)
{
if(form.FWRCfg_Allday){
if(form.FWRCfg_Allday.checked) {
form.FWRCfg_Starthour.disabled = true;
form.FWRCfg_StartMin.disabled = true;
form.FWRCfg_Endhour.disabled = true;
form.FWRCfg_EndMin.disabled = true;
} else {
form.FWRCfg_Starthour.disabled = false;
form.FWRCfg_StartMin.disabled = false;
form.FWRCfg_Endhour.disabled = false;
form.FWRCfg_EndMin.disabled = false;
}
}
return;
}
function SrcAddRule(form)
{
var Srctype = form.FWRCfg_SrcAddrType.selectedIndex;
switch(Srctype)
{
case 0:
Text = "Any";
Value = "Any";
break;
case 1:
Text = form.FWRCfg_SrcStartIP.value;
Value = form.FWRCfg_SrcStartIP.value;
IP =form.FWRCfg_SrcStartIP.value;
IPsplit = IP.split(".");
if((IPsplit[0] == "0") && (IPsplit[1] == "0") && (IPsplit[2] == "0") && (IPsplit[3] == "0")){
alert("Please input Start IP Address");
return;
}
break;
case 2:
Text = form.FWRCfg_SrcStartIP.value + " - " + form.FWRCfg_SrcEndIP.value;
Value = form.FWRCfg_SrcStartIP.value + " - " + form.FWRCfg_SrcEndIP.value;
IP1 =form.FWRCfg_SrcStartIP.value;
IPsplit1 = IP1.split(".");
IP2 =form.FWRCfg_SrcEndIP.value;
IPsplit2 = IP2.split(".");
if(parseInt(IPsplit1[0], 10) > parseInt(IPsplit2[0], 10)){
alert("Invalid IP Address Range");
return;
}
else{
if(parseInt(IPsplit1[1], 10) > parseInt(IPsplit2[1], 10)){
alert("Invalid IP Address Range");
return;
}
else{
if(parseInt(IPsplit1[2], 10) > parseInt(IPsplit2[2], 10)){
alert("Invalid IP Address Range");
return;
}
else{
if(parseInt(IPsplit1[3], 10) > parseInt(IPsplit2[3], 10)){
alert("Invalid IP Address Range");
return;
}
}
}
}
break;
case 3:
Text = form.FWRCfg_SrcStartIP.value + " / " + form.FWRCfg_SrcSubnetMask.value;
Value = form.FWRCfg_SrcStartIP.value + " / " + form.FWRCfg_SrcSubnetMask.value;
IP =form.FWRCfg_SrcSubnetMask.value;
IPsplit = IP.split(".");
if((IPsplit[0] == "0") && (IPsplit[1] == "0") && (IPsplit[2] == "0") && (IPsplit[3] == "0")){
alert("Please input Subnet Mask");
return;
}
break;
default:
break;
}
var length = form.FWRCfg_SrcList.options.length;
if(length > 19){
alert("The maximum number of source address is 20.");
return;
}
for(i = 0; i < length; i++){
var optionString = form.FWRCfg_SrcList.options[i].text;
if(optionString == Text){
return;
}
}
var no = new Option(Text, Value, false, false);
form.FWRCfg_SrcList.options[length] = no;
SrcAddrList(form);
return;
}
function SrcEditRule(form)
{
var obj = form.FWRCfg_SrcList;
var Index = obj.selectedIndex;
if(Index < 0){
Index = 0;
}
var srcString = obj.options[Index].text;
if(srcString.indexOf('Any') >= 0) {
form.FWRCfg_SrcAddrType.selectedIndex = 0;
form.FWRCfg_SrcStartIP.value = "0.0.0.0";
form.FWRCfg_SrcEndIP.value = "0.0.0.0";
form.FWRCfg_SrcSubnetMask.value = "0.0.0.0";
form.FWRCfg_SrcStartIP.disabled = true;
form.FWRCfg_SrcEndIP.disabled = true;
form.FWRCfg_SrcSubnetMask.disabled = true;
} else if(srcString.indexOf('-') >= 0) {
srcString = srcString.replace(/ - /g, "-");
srcSplit = srcString.split("-");
form.FWRCfg_SrcAddrType.selectedIndex = 2;
form.FWRCfg_SrcStartIP.value = srcSplit[0];
form.FWRCfg_SrcEndIP.value = srcSplit[1];
form.FWRCfg_SrcSubnetMask.value = "0.0.0.0";
form.FWRCfg_SrcStartIP.disabled = false;
form.FWRCfg_SrcEndIP.disabled = false;
form.FWRCfg_SrcSubnetMask.disabled = true;
} else if(srcString.indexOf('/') >= 0) {
srcString = srcString.replace(/ \/ /g, "/");
srcSplit = srcString.split("/");
form.FWRCfg_SrcAddrType.selectedIndex = 3;
form.FWRCfg_SrcStartIP.value = srcSplit[0];
form.FWRCfg_SrcEndIP.value = "0.0.0.0";
form.FWRCfg_SrcSubnetMask.value = srcSplit[1];
form.FWRCfg_SrcStartIP.disabled = false;
form.FWRCfg_SrcEndIP.disabled = true;
form.FWRCfg_SrcSubnetMask.disabled = false;
} else {
form.FWRCfg_SrcAddrType.selectedIndex = 1;
form.FWRCfg_SrcStartIP.value = srcString;
form.FWRCfg_SrcEndIP.value = "0.0.0.0";
form.FWRCfg_SrcSubnetMask.value = "0.0.0.0";
form.FWRCfg_SrcStartIP.disabled = false;
form.FWRCfg_SrcEndIP.disabled = true;
form.FWRCfg_SrcSubnetMask.disabled = true;
}
var length = form.FWRCfg_SrcList.options.length;
for(i = Index; i < length-1; i++){
form.FWRCfg_SrcList.options[i].text = form.FWRCfg_SrcList.options[i + 1].text;
}
form.FWRCfg_SrcList.options.length=length -1;
form.FWRCfg_SrcList.selectedIndex = -1;
form.FWRCfg_SrcAdd.disabled = false;
form.FWRCfg_SrcEdit.disabled = true;
form.FWRCfg_SrcDelete.disabled = true;
SrcAddrList(form);
return;
}
function SrcDelRule(form)
{
var length = form.FWRCfg_SrcList.options.length;
var selectIndex = form.FWRCfg_SrcList.selectedIndex;
if(selectIndex < 0){
selectIndex = 0;
}
for(i = selectIndex; i < length-1; i++){
form.FWRCfg_SrcList.options[i].text = form.FWRCfg_SrcList.options[i + 1].text;
}
form.FWRCfg_SrcList.options.length=length -1;
form.FWRCfg_SrcList.selectedIndex = -1;
form.FWRCfg_SrcAdd.disabled = false;
form.FWRCfg_SrcEdit.disabled = true;
form.FWRCfg_SrcDelete.disabled = true;
SrcAddrList(form);
return;
}
function SrcAddrList(form)
{
var length = form.FWRCfg_SrcList.options.length;
var srcString;
form.FWRCfg_SrcSelect.text=length + ",";
for(i = 0; i < length; i++){
srcString = form.FWRCfg_SrcList.options[i].text;
form.FWRCfg_SrcSelect.text = form.FWRCfg_SrcSelect.text + srcString + ",";
}
form.FWRCfg_SrcSelect.value = form.FWRCfg_SrcSelect.text;
return;
}
function DestAddRule(form)
{
var Desttype = form.FWRCfg_DestAddrType.selectedIndex;
switch(Desttype)
{
case 0:
Text = "Any";
Value = "Any";
break;
case 1:
Text = form.FWRCfg_DestStartIP.value;
Value = form.FWRCfg_DestStartIP.value;
IP =form.FWRCfg_DestStartIP.value;
IPsplit = IP.split(".");
if((IPsplit[0] == "0") && (IPsplit[1] == "0") && (IPsplit[2] == "0") && (IPsplit[3] == "0")){
alert("Please input Start IP Address");
return;
}
break;
case 2:
Text = form.FWRCfg_DestStartIP.value + " - " + form.FWRCfg_DestEndIP.value;
Value = form.FWRCfg_DestStartIP.value + " - " + form.FWRCfg_DestEndIP.value;
IP1 =form.FWRCfg_DestStartIP.value;
IPsplit1 = IP1.split(".");
IP2 =form.FWRCfg_DestEndIP.value;
IPsplit2 = IP2.split(".");
if(parseInt(IPsplit1[0], 10) > parseInt(IPsplit2[0], 10)){
alert("Invalid IP Address Range");
return;
}
else{
if(parseInt(IPsplit1[1], 10) > parseInt(IPsplit2[1], 10)){
alert("Invalid IP Address Range");
return;
}
else{
if(parseInt(IPsplit1[2], 10) > parseInt(IPsplit2[2], 10)){
alert("Invalid IP Address Range");
return;
}
else{
if(parseInt(IPsplit1[3], 10) > parseInt(IPsplit2[3], 10)){
alert("Invalid IP Address Range");
return;
}
}
}
}
break;
case 3:
Text = form.FWRCfg_DestStartIP.value + " / " + form.FWRCfg_DestSubnetMask.value;
Value = form.FWRCfg_DestStartIP.value + " / " + form.FWRCfg_DestSubnetMask.value;
IP =form.FWRCfg_DestSubnetMask.value;
IPsplit = IP.split(".");
if((IPsplit[0] == "0") && (IPsplit[1] == "0") && (IPsplit[2] == "0") && (IPsplit[3] == "0")){
alert("Please input Subnet Mask");
return;
}
break;
default:
break;
}
var length = form.FWRCfg_DestList.options.length;
if(length > 19){
alert("The maximum number of destination address is 20.");
return;
}
for(i = 0; i < length; i++){
var optionString = form.FWRCfg_DestList.options[i].text;
if(optionString == Text){
return;
}
}
var no = new Option(Text, Value, false, false);
form.FWRCfg_DestList.options[length] = no;
DestAddrList(form);
return;
}
function DestEditRule(form)
{
var obj = form.FWRCfg_DestList;
var Index = obj.selectedIndex;
if(Index < 0){
Index = 0;
}
var destString = obj.options[Index].text;
if(destString.indexOf('Any') >= 0) {
form.FWRCfg_DestAddrType.selectedIndex = 0;
form.FWRCfg_DestStartIP.value = "0.0.0.0";
form.FWRCfg_DestEndIP.value = "0.0.0.0";
form.FWRCfg_DestSubnetMask.value = "0.0.0.0";
form.FWRCfg_DestStartIP.disabled = true;
form.FWRCfg_DestEndIP.disabled = true;
form.FWRCfg_DestSubnetMask.disabled = true;
} else if(destString.indexOf('-') >= 0) {
destString = destString.replace(/ - /g, "-");
destSplit = destString.split("-");
form.FWRCfg_DestAddrType.selectedIndex = 2;
form.FWRCfg_DestStartIP.value = destSplit[0];
form.FWRCfg_DestEndIP.value = destSplit[1];
form.FWRCfg_DestSubnetMask.value = "0.0.0.0";
form.FWRCfg_DestStartIP.disabled = false;
form.FWRCfg_DestEndIP.disabled = false;
form.FWRCfg_DestSubnetMask.disabled = true;
} else if(destString.indexOf('/') >= 0) {
destString = destString.replace(/ \/ /g, "/");
destSplit = destString.split("/");
form.FWRCfg_DestAddrType.selectedIndex = 3;
form.FWRCfg_DestStartIP.value = destSplit[0];
form.FWRCfg_DestEndIP.value = "0.0.0.0";
form.FWRCfg_DestSubnetMask.value = destSplit[1];
form.FWRCfg_DestStartIP.disabled = false;
form.FWRCfg_DestEndIP.disabled = true;
form.FWRCfg_DestSubnetMask.disabled = false;
} else {
form.FWRCfg_DestAddrType.selectedIndex = 1;
form.FWRCfg_DestStartIP.value = destString;
form.FWRCfg_DestEndIP.value = "0.0.0.0";
form.FWRCfg_DestSubnetMask.value = "0.0.0.0";
form.FWRCfg_DestStartIP.disabled = false;
form.FWRCfg_DestEndIP.disabled = true;
form.FWRCfg_DestSubnetMask.disabled = true;
}
var length = form.FWRCfg_DestList.options.length;
for(i = Index; i < length-1; i++){
form.FWRCfg_DestList.options[i].text = form.FWRCfg_DestList.options[i + 1].text;
}
form.FWRCfg_DestList.options.length=length -1;
form.FWRCfg_DestList.selectedIndex = -1;
form.FWRCfg_DestAdd.disabled = false;
form.FWRCfg_DestEdit.disabled = true;
form.FWRCfg_DestDelete.disabled = true;
DestAddrList(form);
return;
}
function DestDelRule(form)
{
var length = form.FWRCfg_DestList.options.length;
var selectIndex = form.FWRCfg_DestList.selectedIndex;
if(selectIndex < 0){
selectIndex = 0;
}
for(i = selectIndex; i < length-1; i++){
form.FWRCfg_DestList.options[i].text = form.FWRCfg_DestList.options[i + 1].text;
}
form.FWRCfg_DestList.options.length=length -1;
form.FWRCfg_DestList.selectedIndex = -1;
form.FWRCfg_DestAdd.disabled = false;
form.FWRCfg_DestEdit.disabled = true;
form.FWRCfg_DestDelete.disabled = true;
DestAddrList(form);
return;
}
function DestAddrList(form)
{
var length = form.FWRCfg_DestList.options.length;
var DestString;
form.FWRCfg_DestSelect.text=length + ",";
for(i = 0; i < length; i++){
DestString = form.FWRCfg_DestList.options[i].text;
form.FWRCfg_DestSelect.text = form.FWRCfg_DestSelect.text + DestString + ",";
}
form.FWRCfg_DestSelect.value = form.FWRCfg_DestSelect.text;
return;
}
function ServiceSrcFocus(form)
{
form.FWRCfg_ServiceAdd.disabled = false;
form.FWRCfg_ServiceDelete.disabled = true;
}
function ServiceDestFocus(form)
{
form.FWRCfg_ServiceAdd.disabled = true;
form.FWRCfg_ServiceDelete.disabled = false;
}
function ServiceAdd(form)
{
var Index = form.FWRCfg_ServiceSrc.selectedIndex;
if(Index < 0){
Index = 0;
return;
}
var length = form.FWRCfg_ServiceDest.options.length;
Text = form.FWRCfg_ServiceSrc.options[Index].text;
Value = Text;
for(i = 0; i < length; i++){
var optionString = form.FWRCfg_ServiceDest.options[i].text;
if(optionString == Text){
return;
}
}
var no = new Option(Text, Value, false, false);
form.FWRCfg_ServiceDest.options[length] = no;
ServiceList(form);
var Srclength = form.FWRCfg_ServiceSrc.options.length;
var SrcIndex = form.FWRCfg_ServiceSrc.selectedIndex;
for(i = SrcIndex; i < Srclength-1; i++){
form.FWRCfg_ServiceSrc.options[i].text = form.FWRCfg_ServiceSrc.options[i + 1].text;
}
form.FWRCfg_ServiceSrc.options.length=Srclength -1;
form.FWRCfg_ServiceSrc.selectedIndex = -1;
return;
}
function ServiceRemove(form)
{
var DestIndex = form.FWRCfg_ServiceDest.selectedIndex;
var Destlength = form.FWRCfg_ServiceSrc.options.length;
Text = form.FWRCfg_ServiceDest.options[DestIndex].text;
Value = Text;
for(i = 0; i < Destlength; i++){
var optionString = form.FWRCfg_ServiceSrc.options[i].text;
}
var no = new Option(Text, Value, false, false);
form.FWRCfg_ServiceSrc.options[Destlength] = no;
var length = form.FWRCfg_ServiceDest.options.length;
var selectIndex = form.FWRCfg_ServiceDest.selectedIndex;
if(selectIndex < 0){
selectIndex = 0;
}
for(i = selectIndex; i < length-1; i++){
form.FWRCfg_ServiceDest.options[i].text = form.FWRCfg_ServiceDest.options[i + 1].text;
}
form.FWRCfg_ServiceDest.options.length=length -1;
form.FWRCfg_ServiceDest.selectedIndex = -1;
form.FWRCfg_ServiceAdd.disabled = false;
form.FWRCfg_ServiceDelete.disabled = true;
ServiceList(form);
return;
}
function ServiceList(form)
{
var length = form.FWRCfg_ServiceDest.options.length;
var ServiceString;
form.FWRCfg_ServiceSelect.text=length + "&";
for(i = 0; i < length; i++){
ServiceString = form.FWRCfg_ServiceDest.options[i].text;
form.FWRCfg_ServiceSelect.text = form.FWRCfg_ServiceSelect.text + ServiceString + "&";
}
form.FWRCfg_ServiceSelect.value = form.FWRCfg_ServiceSelect.text;
return;
}
function toEditServ()
{
document.forms[0].FWRCfg_EditServ.value=1;
document.forms[0].submit();
}
// -->
